3.14 \(\int \frac{1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx\)

Optimal. Leaf size=187 \[ \frac{2 a^2 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{f \sqrt{a-b} \sqrt{a+b} (a c-b d)^2}+\frac{d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac{2 d \left (2 a c^2-a d^2-b c d\right ) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{f (c-d)^{3/2} (c+d)^{3/2} (a c-b d)^2} \]

[Out]

(2*a^2*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(Sqrt[a - b]*Sqrt[a + b]*(a*c - b*d)^2*f) - (2*d*(2
*a*c^2 - b*c*d - a*d^2)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/((c - d)^(3/2)*(c + d)^(3/2)*(a*c
 - b*d)^2*f) + (d^2*Sin[e + f*x])/((a*c - b*d)*(c^2 - d^2)*f*(d + c*Cos[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.631187, antiderivative size = 187, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 6, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.24, Rules used = {2828, 3056, 3001, 2659, 205, 208} \[ \frac{2 a^2 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{f \sqrt{a-b} \sqrt{a+b} (a c-b d)^2}+\frac{d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac{2 d \left (2 a c^2-a d^2-b c d\right ) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{f (c-d)^{3/2} (c+d)^{3/2} (a c-b d)^2} \]

Antiderivative was successfully verified.

[In]

Int[1/((a + b*Cos[e + f*x])*(c + d*Sec[e + f*x])^2),x]

[Out]

(2*a^2*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(Sqrt[a - b]*Sqrt[a + b]*(a*c - b*d)^2*f) - (2*d*(2
*a*c^2 - b*c*d - a*d^2)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/((c - d)^(3/2)*(c + d)^(3/2)*(a*c
 - b*d)^2*f) + (d^2*Sin[e + f*x])/((a*c - b*d)*(c^2 - d^2)*f*(d + c*Cos[e + f*x]))

Rule 2828

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> In
t[((a + b*Sin[e + f*x])^m*(d + c*Sin[e + f*x])^n)/Sin[e + f*x]^n, x] /; FreeQ[{a, b, c, d, e, f, m}, x] && Int
egerQ[n]

Rule 3056

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (C_.)*s
in[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[((A*b^2 + a^2*C)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1)*(c +
d*Sin[e + f*x])^(n + 1))/(f*(m + 1)*(b*c - a*d)*(a^2 - b^2)), x] + Dist[1/((m + 1)*(b*c - a*d)*(a^2 - b^2)), I
nt[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[a*(m + 1)*(b*c - a*d)*(A + C) + d*(A*b^2 + a^2*C)*
(m + n + 2) - (c*(A*b^2 + a^2*C) + b*(m + 1)*(b*c - a*d)*(A + C))*Sin[e + f*x] - d*(A*b^2 + a^2*C)*(m + n + 3)
*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0]
 && NeQ[c^2 - d^2, 0] && LtQ[m, -1] && ((EqQ[a, 0] && IntegerQ[m] &&  !IntegerQ[n]) ||  !(IntegerQ[2*n] && LtQ
[n, -1] && ((IntegerQ[n] &&  !IntegerQ[m]) || EqQ[a, 0])))

Rule 3001

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.)
+ (f_.)*(x_)])), x_Symbol] :> Dist[(A*b - a*B)/(b*c - a*d), Int[1/(a + b*Sin[e + f*x]), x], x] + Dist[(B*c - A
*d)/(b*c - a*d), Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rubi steps

\begin{align*} \int \frac{1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx &=\int \frac{\cos ^2(e+f x)}{(a+b \cos (e+f x)) (d+c \cos (e+f x))^2} \, dx\\ &=\frac{d^2 \sin (e+f x)}{(a c-b d) \left (c^2-d^2\right ) f (d+c \cos (e+f x))}+\frac{\int \frac{-a c d-\left (b c d-a \left (c^2-d^2\right )\right ) \cos (e+f x)}{(a+b \cos (e+f x)) (d+c \cos (e+f x))} \, dx}{(a c-b d) \left (c^2-d^2\right )}\\ &=\frac{d^2 \sin (e+f x)}{(a c-b d) \left (c^2-d^2\right ) f (d+c \cos (e+f x))}+\frac{a^2 \int \frac{1}{a+b \cos (e+f x)} \, dx}{(a c-b d)^2}+\frac{\left (d \left (b c d-a \left (2 c^2-d^2\right )\right )\right ) \int \frac{1}{d+c \cos (e+f x)} \, dx}{(a c-b d)^2 \left (c^2-d^2\right )}\\ &=\frac{d^2 \sin (e+f x)}{(a c-b d) \left (c^2-d^2\right ) f (d+c \cos (e+f x))}+\frac{\left (2 a^2\right ) \operatorname{Subst}\left (\int \frac{1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{(a c-b d)^2 f}+\frac{\left (2 d \left (b c d-a \left (2 c^2-d^2\right )\right )\right ) \operatorname{Subst}\left (\int \frac{1}{c+d+(-c+d) x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{(a c-b d)^2 \left (c^2-d^2\right ) f}\\ &=\frac{2 a^2 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{\sqrt{a-b} \sqrt{a+b} (a c-b d)^2 f}-\frac{2 d \left (2 a c^2-b c d-a d^2\right ) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{(c-d)^{3/2} (c+d)^{3/2} (a c-b d)^2 f}+\frac{d^2 \sin (e+f x)}{(a c-b d) \left (c^2-d^2\right ) f (d+c \cos (e+f x))}\\ \end{align*}

Mathematica [A]  time = 0.783142, size = 205, normalized size = 1.1 \[ \frac{\sec ^2(e+f x) (c \cos (e+f x)+d) \left (-\frac{2 a^2 (c \cos (e+f x)+d) \tanh ^{-1}\left (\frac{(a-b) \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{b^2-a^2}}\right )}{\sqrt{b^2-a^2}}-\frac{2 d \left (a \left (d^2-2 c^2\right )+b c d\right ) (c \cos (e+f x)+d) \tanh ^{-1}\left (\frac{(d-c) \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{\left (c^2-d^2\right )^{3/2}}+\frac{d^2 (a c-b d) \sin (e+f x)}{(c-d) (c+d)}\right )}{f (a c-b d)^2 (c+d \sec (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[1/((a + b*Cos[e + f*x])*(c + d*Sec[e + f*x])^2),x]

[Out]

((d + c*Cos[e + f*x])*Sec[e + f*x]^2*((-2*a^2*ArcTanh[((a - b)*Tan[(e + f*x)/2])/Sqrt[-a^2 + b^2]]*(d + c*Cos[
e + f*x]))/Sqrt[-a^2 + b^2] - (2*d*(b*c*d + a*(-2*c^2 + d^2))*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt[c^2 - d
^2]]*(d + c*Cos[e + f*x]))/(c^2 - d^2)^(3/2) + (d^2*(a*c - b*d)*Sin[e + f*x])/((c - d)*(c + d))))/((a*c - b*d)
^2*f*(c + d*Sec[e + f*x])^2)

________________________________________________________________________________________

Maple [B]  time = 0.09, size = 418, normalized size = 2.2 \begin{align*} -2\,{\frac{{d}^{2}\tan \left ( 1/2\,fx+e/2 \right ) ac}{f \left ( ac-bd \right ) ^{2} \left ({c}^{2}-{d}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}c- \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}d-c-d \right ) }}+2\,{\frac{{d}^{3}\tan \left ( 1/2\,fx+e/2 \right ) b}{f \left ( ac-bd \right ) ^{2} \left ({c}^{2}-{d}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}c- \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}d-c-d \right ) }}-4\,{\frac{a{c}^{2}d}{f \left ( ac-bd \right ) ^{2} \left ( c+d \right ) \left ( c-d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{ \left ( c-d \right ) \tan \left ( 1/2\,fx+e/2 \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }+2\,{\frac{a{d}^{3}}{f \left ( ac-bd \right ) ^{2} \left ( c+d \right ) \left ( c-d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{ \left ( c-d \right ) \tan \left ( 1/2\,fx+e/2 \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }+2\,{\frac{bc{d}^{2}}{f \left ( ac-bd \right ) ^{2} \left ( c+d \right ) \left ( c-d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{ \left ( c-d \right ) \tan \left ( 1/2\,fx+e/2 \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }+2\,{\frac{{a}^{2}}{f \left ( ac-bd \right ) ^{2}\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}\arctan \left ({\frac{ \left ( a-b \right ) \tan \left ( 1/2\,fx+e/2 \right ) }{\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x)

[Out]

-2/f*d^2/(a*c-b*d)^2/(c^2-d^2)*tan(1/2*f*x+1/2*e)/(tan(1/2*f*x+1/2*e)^2*c-tan(1/2*f*x+1/2*e)^2*d-c-d)*a*c+2/f*
d^3/(a*c-b*d)^2/(c^2-d^2)*tan(1/2*f*x+1/2*e)/(tan(1/2*f*x+1/2*e)^2*c-tan(1/2*f*x+1/2*e)^2*d-c-d)*b-4/f*d/(a*c-
b*d)^2/(c+d)/(c-d)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(1/2))*a*c^2+2/f*d^3/(a*
c-b*d)^2/(c+d)/(c-d)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(1/2))*a+2/f*d^2/(a*c-
b*d)^2/(c+d)/(c-d)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(1/2))*b*c+2/f*a^2/(a*c-
b*d)^2/((a+b)*(a-b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a+b)*(a-b))^(1/2))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{1}{\left (a + b \cos{\left (e + f x \right )}\right ) \left (c + d \sec{\left (e + f x \right )}\right )^{2}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))**2,x)

[Out]

Integral(1/((a + b*cos(e + f*x))*(c + d*sec(e + f*x))**2), x)

________________________________________________________________________________________

Giac [B]  time = 1.2708, size = 462, normalized size = 2.47 \begin{align*} \frac{2 \,{\left (\frac{{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - b \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{\sqrt{a^{2} - b^{2}}}\right )\right )} a^{2}}{{\left (a^{2} c^{2} - 2 \, a b c d + b^{2} d^{2}\right )} \sqrt{a^{2} - b^{2}}} - \frac{d^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{{\left (a c^{3} - b c^{2} d - a c d^{2} + b d^{3}\right )}{\left (c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - c - d\right )}} - \frac{{\left (2 \, a c^{2} d - b c d^{2} - a d^{3}\right )}{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{\sqrt{-c^{2} + d^{2}}}\right )\right )}}{{\left (a^{2} c^{4} - 2 \, a b c^{3} d - a^{2} c^{2} d^{2} + b^{2} c^{2} d^{2} + 2 \, a b c d^{3} - b^{2} d^{4}\right )} \sqrt{-c^{2} + d^{2}}}\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="giac")

[Out]

2*((pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(2*a - 2*b) + arctan((a*tan(1/2*f*x + 1/2*e) - b*tan(1/2*f*x + 1/2*e))
/sqrt(a^2 - b^2)))*a^2/((a^2*c^2 - 2*a*b*c*d + b^2*d^2)*sqrt(a^2 - b^2)) - d^2*tan(1/2*f*x + 1/2*e)/((a*c^3 -
b*c^2*d - a*c*d^2 + b*d^3)*(c*tan(1/2*f*x + 1/2*e)^2 - d*tan(1/2*f*x + 1/2*e)^2 - c - d)) - (2*a*c^2*d - b*c*d
^2 - a*d^3)*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*f*x + 1/2*e) - d*tan(1/2*f*
x + 1/2*e))/sqrt(-c^2 + d^2)))/((a^2*c^4 - 2*a*b*c^3*d - a^2*c^2*d^2 + b^2*c^2*d^2 + 2*a*b*c*d^3 - b^2*d^4)*sq
rt(-c^2 + d^2)))/f